    package cn.com.nes.site.controller.maintenanceReminder;

    import cn.com.nes.common.web.CommonResult;
    import cn.com.nes.site.entity.vo.maintenanceReminder.MaintenanceEquipmentVo;
    import cn.com.nes.site.service.maintenanceReminder.MaintenanceEquipmentService;
    import io.swagger.annotations.Api;
    import org.springframework.stereotype.Controller;
    import org.springframework.validation.annotation.Validated;
    import org.springframework.web.bind.annotation.RequestBody;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RequestMethod;
    import org.springframework.web.bind.annotation.ResponseBody;

    import javax.annotation.Resource;

    /**
     * 设备巡检相关信息
     *
     * @author nes
     * @date 2018-11-10 21:22
     */
    @Api(tags = {"增加维保设备信息"})
    @Controller
    @RequestMapping("/v2/maintenanceEquipment")
    public class MaintenanceEquipmentController {
        @Resource
        private MaintenanceEquipmentService maintenanceEquipmentService;


        @RequestMapping(value = "/addMaintenanceEquipment", method = RequestMethod.POST)
        @ResponseBody
        public CommonResult<?> addMaintenanceEquipment(@RequestBody @Validated MaintenanceEquipmentVo vo) {
            Integer res = maintenanceEquipmentService.addMaintenanceEquipment(vo);
            if (res > 0) {
                return CommonResult.ok();
            } else {
                return CommonResult.error("保存失败");
            }

        }

        @RequestMapping(value = "/queryMaintenanceEquipment", method = RequestMethod.POST)
        @ResponseBody
        public CommonResult<?> queryMaintenanceEquipment(@RequestBody @Validated MaintenanceEquipmentVo vo) {
            return CommonResult.page(maintenanceEquipmentService.queryMaintenanceEquipment(vo));
        }

        @RequestMapping(value = "/deleteMaintenanceEquipment", method = RequestMethod.POST)
        @ResponseBody
        public CommonResult<?> deleteMaintenanceEquipment(@RequestBody @Validated MaintenanceEquipmentVo vo) {
            Integer res = maintenanceEquipmentService.deleteMaintenanceEquipment(vo);
            if (res > 0) {
                return CommonResult.ok();
            } else {
                return CommonResult.error("删除失败");
            }
        }
        @RequestMapping(value = "/updateMaintenanceEquipment", method = RequestMethod.POST)
        @ResponseBody
        public CommonResult<?> updateMaintenanceEquipment(@RequestBody @Validated MaintenanceEquipmentVo vo) {
            Integer res = maintenanceEquipmentService.updateMaintenanceEquipment(vo);
            if (res > 0) {
                return CommonResult.ok();
            } else {
                return CommonResult.error("删除失败");
            }
        }
    }
